import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/layout/index.vue'

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    name: '',
    component: Index,
    meta: {level: 1, click: false},
    children: [
      {
        path: 'home',
        name: 'home',
        meta: {level: 2, click: true},
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/layout/home.vue')
      },
      {
        path: 'markdown',
        name: 'markdown',
        meta: {level: 2, click: false},
        component: () => import('@/views/modules/markdownDemo/index.vue'),
        children:[
          {
            path: 'quill',
            name: 'quill',
            meta: {level: 2, click: false},
            component: () => import('@/views/modules/markdownDemo/quill.vue'),
          }
        ]
      },
      {
        path: 'echarts',
        name: 'echarts',
        meta: {level: 2, click: false},
        component: () => import('@/views/modules/echarts/index.vue'),
        children:[
          {
            path: 'echart',
            name: 'echart',
            meta: {level: 2, click: false},
            component: () => import('@/views/modules/echarts/echart.vue'),
          },{
            path: 'echart-dynamic',
            name: 'echart-dynamic',
            meta: {level: 2, click: false},
            component: () => import('@/views/modules/echarts/echart-dynamic.vue'),
          }
        ]
      },
      {
        path: 'table',
        name: 'table',
        meta: {level: 2, click: false},
        component: () => import('@/views/modules/table/index.vue'),
        children:[
          {
            path: 'simple',
            name: 'simple',
            meta: {level: 2, click: false},
            component: () => import('@/views/modules/table/simple.vue'),
          }
        ]
      }
    ]
  }
];

const router = new VueRouter({
  mode: 'history',
  base: 'demo',
  routes
});

export default router
